package com.oazon.common.util;
public class DataFormat {

	public static String formatDuring(long mss) {
		long hours = mss / (1000 * 60 * 60);
		long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
		long seconds = (mss % (1000 * 60)) / 1000;
		return hours + ":" + addFormate(minutes) + ":" +  addFormate(seconds);
	}

	private static String addFormate(long time) {
		if (time < 10) {
			return "0" + time;
		} else {
			return String.valueOf(time);
		}
	}
	
	public static long valueOfdate(String date){
		long time = 0;
		String [] times = date.split("[:]");
		time += Integer.parseInt(times[0])*60*60*1000;
		time += Integer.parseInt(times[1])*60*1000;
		time += Integer.parseInt(times[2])*1000;
		return time;
	}
}
